<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>按品牌名查询</title>
<style type="text/css">
  body{
    width:1280px;
    margin:0 auto;
  }
  table {
  	border-collapse:collapse;
  }
  table tr th, table tr td {
    text-align:center;
  }
  .pageList{
    float:right;
    clear:both;
  }
  .pageList_foot{
    clear:both;
    margin-bottom:20px;
    text-align:center;
  }
  .brandList{
    float:right;
    clear:both;
    width:100%;
  }
</style>
<script>
  function pre(){
    var pageNo = parseInt(document.getElementById("pageNo").value);
    if (pageNo > 1) {
      pageNo = pageNo - 1;
    }
    goPage(pageNo);
  }
  function next() {
    var pageNo = parseInt(document.getElementById("pageNo").value);
    var totalPage = parseInt(document.getElementById("totalPage").value);
    if (pageNo < totalPage) {
      pageNo = pageNo + 1;
    }
    goPage(pageNo);
  }
  function last() {
    var totalPage = parseInt(document.getElementById("totalPage").value);
    goPage(totalPage);
  }
  function goPage(pageNo) {
    var currentPage = parseInt(document.getElementById("pageNo").value);
    var totalPage = parseInt(document.getElementById("totalPage").value);
    if (currentPage == 1 && pageNo == 1) {
      alert("已在首页");
      return false;
    }
    if (currentPage == totalPage && pageNo == totalPage) {
      alert("已达最后一页");
      return false;
    }
    location.href="showAutoBrand.action?pageNo="+pageNo;
  }
</script>
</head>
<body>
	<div class="ab-head">
	<s:include value="/WEB-INF/page/car/common/head.jsp"></s:include>
	</div>
	<div class="pageList">
	共${totalRecordCount}条记录,当前是第${currentPage}页，共${totalPage}页
	<a href="javascript:void(0)" onclick="goPage(1)">首页</a>&nbsp;<a href="javascript:void(0)" onclick="pre()">上一页</a>&nbsp;<a href="javascript:void(0)" onclick="next()">下一页</a>&nbsp;<a href="javascript:void(0)" onclick="last()">最后一页</a>&nbsp;
	</div>
	<div class="brandList">
		<table border="1" cellpadding="0" cellspacing="0" width="100%">
			<thead>
				<tr>
					<th>来源网站</th>
					<th>品牌</th>
					<th>车型库</th>
			        <th>厂商</th>
				</tr>
		    </thead>
		    <tbody>
		    	<s:iterator id="autoBrandList" value="#request.autoBrandList" status="st">
		    	<tr>
		    		<td><s:property value="hostName"/></td>
		    		<td><s:property value="brand"/></td>
		    		<td><a href="<s:property value="more_series_link"/>" target="_blank"><s:property value="brand"/>车型库</a></td>
		    		<td>
		    			<div>
						<table border="1" cellpadding="0" cellspacing="0" width="100%">
							<s:iterator value="factory.items" id="factoryItem">
							<tr>
								<td width="20%"><s:property value="#factoryItem.name"/></td>
								<td width="80%">
									<div>
										<table border="1" cellpadding="0" cellspacing="0"  width="100%">
											<tr>
												<th width="50%">车系</th>
												<th width="50%">价格</th>
											</tr>
											<s:iterator value="#factoryItem.toplist.items" id="toplistItem">
											<tr>
												<td><a href="<s:property value="#toplistItem.link"/>" target="_blank"><s:property value="#toplistItem.series"/></a></td>
												<td><s:property value="#toplistItem.price"/></td>
											</tr>
											</s:iterator>
										</table>
									</div>
								</td>
							</tr>
							</s:iterator>
						</table>
		    			</div>
					</td>
		    	</tr>
		    	</s:iterator>
		    </tbody>
		</table>
	</div>
	<div class="pageList_foot">
	共${totalRecordCount}条记录,当前是第${currentPage}页，共${totalPage}页
	<a href="javascript:void(0)" onclick="goPage(1)">首页</a>&nbsp;<a href="javascript:void(0)" onclick="pre()">上一页</a>&nbsp;<a href="javascript:void(0)" onclick="next()">下一页</a>&nbsp;<a href="javascript:void(0)" onclick="last()">最后一页</a>&nbsp;
	</div>
	<input type="hidden" name="pageSize" id="pageSize" value="${pagesize}"/>
	<input type="hidden" name="currentPage" id="currentPage" value="${currentPage}"/>
	<input type="hidden" name="pageNo" id="pageNo" value="${pageNo}"/>
	<input type="hidden" name="totalPage" id="totalPage" value="${totalPage}"/>
</body>
</html>